home *** CD-ROM | disk | FTP | other *** search
/ Hardcore Visual Basic 5.0 (2nd Edition) / Hardcore Visual Basic 5.0 - Second Edition (1997)(Microsoft Press).iso / Code / TThread.frm < prev    next >
Text File  |  1997-06-14  |  4KB  |  128 lines

  1. VERSION 5.00
  2. Begin VB.Form FTestThread 
  3.    Caption         =   "Test Thread"
  4.    ClientHeight    =   3345
  5.    ClientLeft      =   1395
  6.    ClientTop       =   2070
  7.    ClientWidth     =   4410
  8.    Icon            =   "TThread.frx":0000
  9.    LinkTopic       =   "Form1"
  10.    ScaleHeight     =   3345
  11.    ScaleWidth      =   4410
  12.    Begin VB.CommandButton cmdStartStop 
  13.       Caption         =   "&Start Thread"
  14.       Height          =   495
  15.       Left            =   324
  16.       TabIndex        =   9
  17.       Top             =   216
  18.       Width           =   1548
  19.    End
  20.    Begin VB.TextBox txtStartStop 
  21.       Height          =   375
  22.       Left            =   2508
  23.       TabIndex        =   7
  24.       Text            =   "0"
  25.       Top             =   480
  26.       Width           =   1575
  27.    End
  28.    Begin VB.TextBox txtAPI 
  29.       Height          =   375
  30.       Left            =   2508
  31.       TabIndex        =   5
  32.       Top             =   1950
  33.       Width           =   1575
  34.    End
  35.    Begin VB.TextBox txtBasic 
  36.       Height          =   375
  37.       Left            =   2508
  38.       TabIndex        =   3
  39.       Top             =   2685
  40.       Width           =   1575
  41.    End
  42.    Begin VB.TextBox txtCalc 
  43.       Height          =   375
  44.       Left            =   2508
  45.       TabIndex        =   1
  46.       Top             =   1215
  47.       Width           =   1575
  48.    End
  49.    Begin VB.CommandButton cmdUpdate 
  50.       Caption         =   "Update Data"
  51.       Height          =   495
  52.       Left            =   324
  53.       TabIndex        =   0
  54.       Top             =   828
  55.       Width           =   1548
  56.    End
  57.    Begin VB.Label lblStartStop 
  58.       Caption         =   "Argument:"
  59.       Height          =   240
  60.       Left            =   2508
  61.       TabIndex        =   8
  62.       Top             =   240
  63.       Width           =   1440
  64.    End
  65.    Begin VB.Label lbl 
  66.       Caption         =   "API count:"
  67.       Height          =   240
  68.       Index           =   1
  69.       Left            =   2505
  70.       TabIndex        =   6
  71.       Top             =   1710
  72.       Width           =   1440
  73.    End
  74.    Begin VB.Label lbl 
  75.       Caption         =   "Basic time:"
  76.       Height          =   240
  77.       Index           =   2
  78.       Left            =   2505
  79.       TabIndex        =   4
  80.       Top             =   2445
  81.       Width           =   1440
  82.    End
  83.    Begin VB.Label lbl 
  84.       Caption         =   "Calculated count:"
  85.       Height          =   240
  86.       Index           =   0
  87.       Left            =   2505
  88.       TabIndex        =   2
  89.       Top             =   975
  90.       Width           =   1440
  91.    End
  92. End
  93. Attribute VB_Name = "FTestThread"
  94. Attribute VB_GlobalNameSpace = False
  95. Attribute VB_Creatable = False
  96. Attribute VB_PredeclaredId = True
  97. Attribute VB_Exposed = False
  98. Option Explicit
  99.  
  100. Private Sub cmdStartStop_Click()
  101.     If cmdStartStop.Caption = "&Start Thread" Then
  102.         StartThread txtStartStop
  103.         cmdStartStop.Caption = "&Stop Thread"
  104.         lblStartStop.Caption = "Return value:"
  105.         cmdUpdate_Click
  106.     Else
  107.         txtStartStop = StopThread
  108.         cmdStartStop.Caption = "&Start Thread"
  109.         lblStartStop.Caption = "Argument:"
  110.         cmdUpdate_Click
  111.     End If
  112. End Sub
  113.  
  114. Private Sub cmdUpdate_Click()
  115.     txtCalc = CalcCount
  116.     txtAPI = APICount
  117.     txtBasic = BasicTime
  118. End Sub
  119.  
  120. Private Sub Form_Load()
  121.     Randomize 5
  122.     Debug.Print "Caller: " & Rnd
  123. End Sub
  124.  
  125. Private Sub Form_Unload(Cancel As Integer)
  126.     If ThreadRunning Then StopThread
  127. End Sub
  128.